package first.codeTop.alibaba;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName LC94
 * @description:
 * @author: 荣燊
 * @create: 2021-10-14 20:34
 **/
public class LC94 {
    public static void main(String[] args) {
        TreeNode root = new TreeNode(1);
        root.right = new TreeNode(2);
        root.right.left = new TreeNode(3);
        System.out.println(inorderTraversal(root));
    }

    static ArrayList<Integer> result = new ArrayList<>();

    public static List<Integer> inorderTraversal(TreeNode root) {
        dfs(root);
        return result;
    }

    public static void dfs(TreeNode root) {
        if (root == null) {
            return;
        }
        dfs(root.left);
        result.add(root.val);
        dfs(root.right);
    }

}
